<template>
	<div class="goodinfo_div">
		<mt-navbar class="goodinfo_header">
			<p class="btn_back" @click="btn_back">返回</p>
			<mt-tab-item id="1" class="colorA9" :class="active === 'SP'?'color32':''" @click.native.prevent="active = 'SP'">商品</mt-tab-item>
			<mt-tab-item id="2" class="colorA9" :class="active === 'XQ'?'color32':''" @click.native.prevent="active = 'XQ'">详情</mt-tab-item>
			<mt-tab-item id="3" class="colorA9" :class="active === 'PJ'?'color32':''" @click.native.prevent="active = 'PJ'">评价</mt-tab-item>
        </mt-navbar>
        <mt-tab-container v-model="active" ><!--swipeable-->
			<mt-tab-container-item id="SP">
				<gooddesc-com ></gooddesc-com><!--:prop_data_goodInfo="data_goodInfo"-->
			</mt-tab-container-item>
			<mt-tab-container-item id="XQ">
				<gooddetail-com ></gooddetail-com><!--:prop_data_godEval="data_goodEval"-->
			</mt-tab-container-item>
			<mt-tab-container-item id="PJ">
				<goodeval-com></goodeval-com>
			</mt-tab-container-item>
		</mt-tab-container>
		<choosetype-com :msg="sheetVisible" v-show="sheetVisible != ''"></choosetype-com>
		<youlike-com></youlike-com>
		<buynow-com></buynow-com>
	</div>
</template>
<script>
	import gooddesc from './gooddesc.vue'
	import gooddetail from './gooddetail.vue'
	import goodeval from './goodeval.vue'
	import buynow from './buynow.vue'
	import youlike from './youlike.vue'
	import choosetype from './choosetype.vue'
	export default{
		name:'goodinfo',
		data(){
			return {
				active:'SP',
				sheetVisible: '',
				curGoodId:'',
			}
		},
		components:{
			"gooddesc-com":gooddesc,
			"gooddetail-com":gooddetail,
			"goodeval-com":goodeval,
			"youlike-com":youlike,
			"buynow-com":buynow,
			"choosetype-com":choosetype,
		},
		methods:{
			btn_back:function(){
				this.$router.go(-1);
			},
			getGoodInfo(){
				document.body.scrollTop = 0;
				this.$store.state.goods.curGoodId = this.$route.params.goodId;
				//console.log(this.$route.params.goodId)// 输出参数
				if(this.$route.params.goodId == undefined){
					return false;
				}
				localMethod.prototype.set('goodId',this.$route.params.goodId);
				this.$store.dispatch('get_goodInfo'); //商品详情页  第一个tab 商品
				this.$store.dispatch('get_goodDetail'); //商品详情页  第二个tab 详情
				this.$store.dispatch('get_goodEval'); //商品详情页  第三个tab 评价
			}
		},
		computed:{
			
		},
		mounted:function(){
			this.getGoodInfo()
		},
		created:function(){
			//this.getGoodInfo()
		},
		watch:{
			"$route":"getGoodInfo" 
		}
	}
</script>
<style rel="stylesheet" scoped>
	.goodinfo_div{
		background-color: #F5F5F5;
	}
</style>